﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel.Design;

namespace Obra.Api
{
    /// <summary>
    /// Interface to interact with a media service such as SmugMug.
    /// </summary>
    public interface IMediaService :
        IServiceContainer,
        IServiceProvider
    {
        /// <summary>
        /// Session information for this service.
        /// </summary>
        ISession Session
        {
            get;
        }

        /// <summary>
        /// Logon (connect) to a media service.
        /// </summary>
        /// <param name="userName">
        /// Username to use for authentication.
        /// </param>
        /// <param name="password">
        /// Password to use for authenticating this user.
        /// </param>
        void LogOn(
            string userName,
            string password);

        /// <summary>
        /// Logoff (disconnect) from a media service.
        /// </summary>
        void LogOff();

        /// <summary>
        /// Get a list of albums for this username on the media service.
        /// </summary>
        IList<IAlbum> Albums
        {
            get;
        }

        /// <summary>
        /// Create a new album.
        /// </summary>
        /// <param name="name">
        /// Name of the album.
        /// </param>
        /// <returns>
        /// Created album.
        /// </returns>
        IAlbum CreateAlbum(string name);

        /// <summary>
        /// Delete the specified album.
        /// </summary>
        /// <param name="album">
        /// Album to delete.
        /// </param>
        void DeleteAlbum(IAlbum album);

        /// <summary>
        /// Delete the specified media file.
        /// </summary>
        /// <param name="album">
        /// Album containing the media item to delete.
        /// </param>
        /// <param name="media">
        /// Media item to delete.
        /// </param>
        void DeleteMediaFile(IAlbum album, IMedia media);

        /// <summary>
        /// Upload a media file to the specified album.
        /// </summary>
        /// <param name="album">
        /// The album to upload the media to.
        /// </param>
        /// <param name="mediaName">
        /// The name of the media file to upload.
        /// </param>
        /// <param name="mediaStream">
        /// Stream containing the contents of the media file to upload.
        /// </param>
        void UploadMediaFile(
            IAlbum album,
            string mediaName,
            Stream mediaStream);

        /// <summary>
        /// Download media data from the specified album.
        /// </summary>
        /// <param name="album">
        /// The album to download the media from.
        /// </param>
        /// <param name="media">
        /// The media to download.
        /// </param>
        /// <returns>
        /// Stream object containing the bits to download.
        /// </returns>
        Stream DownloadMediaFile(
            IMedia media);
    }
}
